<?php
ob_start();
$host="localhost";
$username="root";
$password="";
$database="cs4400_group17";

$tbl_name="user";

mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

echo "CALLING ME";

$registerName=$_POST['Name'];
$registerEmail=$_POST['Email'];
$registerPeb=$_POST['Pin'];

// To protect MySQL injection
$registerName = stripslashes($registerName);
$registerEmail = stripslashes($registerEmail);
$registerPeb = stripslashes($registerPeb);
$registerName = mysql_real_escape_string($registerName);
$registerEmail = mysql_real_escape_string($registerEmail);
$registerPeb = mysql_real_escape_string($registerPeb);

$query = "INSERT INTO $tbl_name VALUES('$registerEmail','$registerPeb','$registerName')";

$result = mysql_query($query);
if(!$result){
	echo "SOMEHTING WENT FUCKING WRONG";
}
elseif($registerName == "" or $registerEmail ==""  or $registerPeb=="" ){
	header("location:registerFail.html");
}
else{
	header("location:success.html");
}
mysql_close();

ob_end_flush();
?>